<template>
  <n-config-provider :theme-overrides="themeOverrides" :theme="theme">
    <n-loading-bar-provider>
      <n-dialog-provider>
        <n-notification-provider>
          <n-message-provider>
            <div class="naive-provider">
              <slot></slot>
            </div>
          </n-message-provider>
        </n-notification-provider>
      </n-dialog-provider>
    </n-loading-bar-provider>
  </n-config-provider>
</template>

<script setup lang="ts">
import { computed } from "vue";
import { darkTheme } from "naive-ui";
import { useLayoutStore } from "@/store/modules/layout";
import { useTheme } from "@/hooks/useTheme";

const layoutStore = useLayoutStore();
const { themeOverrides } = useTheme();

const theme = computed(() => {
  return layoutStore.layout.theme === "dark" ? darkTheme : null;
});
</script>

<style>
.naive-provider {
  width: 100%;
  height: 100%;
}

.n-layout {
  height: 100%;
}

.n-layout-scroll-container {
  min-height: 100%;
}
</style>
